package com.ruoyi.framework.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 静态资源映射配置
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Value("${ruoyi.profile}")
    private String profilePath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 映射 /profile/** 请求到文件系统目录
        registry.addResourceHandler("/profile/**")
                .addResourceLocations("file:" + profilePath + "/");
    }
}
